package com.example.ruiji.service.userSerice;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.example.ruiji.dao.mapper.UserMapper;
import com.example.ruiji.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Author:BaiYiChen
 * Date:2022/4/20 12:26
 *
 * @author BaiYiChen
 */
@Service
public class UserServiceImpl implements UserService{
  @Autowired
  private UserMapper userMapper;
  @Override
  public User findUserById(Integer id) {
    return userMapper.findUserById(id);
  }
  
  @Override
  public User findUserByAccount(String account) {
    LambdaQueryWrapper<User> queryWrapper = new LambdaQueryWrapper<>();
    queryWrapper.eq(User::getAccount,account);
    
    User user = userMapper.selectOne(queryWrapper);
    return user;
  }
}
